package leetcode.code1736;

import leetcode.IDebug;

public class Solution implements IDebug {

	public String maximumTime(String time) {
		char[] cs = time.toCharArray();
		char[] ans = new char[5];
		ans[2] = ':';
		if (cs[0] == '?') {
			if (cs[1] < '4' || cs[1] == '?') {
				ans[0] = '2';
			} else {
				ans[0] = '1';
			}
		} else {
			ans[0] = cs[0];
		}
		if (cs[1] == '?') {
			if (ans[0] == '2') {
				ans[1] = '3';
			} else {
				ans[1] = '9';
			}
		} else {
			ans[1] = cs[1];
		}
		ans[3] = cs[3] == '?' ? '5' : cs[3];
		ans[4] = cs[4] == '?' ? '9' : cs[4];
		return new String(ans);
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
